package cn.tedu.tmall.admin.content.controller;

import cn.tedu.tmall.common.web.JsonResult;
import cn.tedu.tmall.admin.content.pojo.ArticleAddParam;
import cn.tedu.tmall.admin.content.service.IArticleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/articles")
@Tag(name="文章接口")
@Validated
@Slf4j
public class ArticleController {
    @Autowired
    private IArticleService articleService;
    @Operation(summary = "增加文章")
    @PostMapping("/add")
    public JsonResult add(@Validated @RequestBody ArticleAddParam articleAddParam) {
        articleService.add(articleAddParam);
        return JsonResult.ok();
    }

}
